home *** CD-ROM | disk | FTP | other *** search
/ Biodiversity of Illinois 2: Woodland Habitats / Biodiversity of Illinois 2 - Woodland Habitats.iso / mac / casts / PDFxtraBehaviors.cst / 00019_Script_PDF_CloseViewer < prev    next >
Text File  |  2006-07-11  |  3KB  |  91 lines

  1. -- Close the PDF application
  2.  
  3. Property pEvent, pSprite, pFileName, pPathType, pEnableUpdateFromURL, pUpdateFromURL, pPage, pZoom, pScale, pDisplayMode, pToolbar, pScrollbars, pScrollH, pScrollV, pAlertFlag
  4.  
  5. on doClose me
  6.   set err = PDF_CloseViewer()
  7. end doClose
  8.  
  9. on mouseUp me
  10.   if (pEvent = #mouseUp) then doClose(me)
  11. end mouseUp
  12.  
  13. on mouseDown me
  14.   if (pEvent = #mouseDown) then doClose(me)
  15. end mouseDown
  16.  
  17. on prepareFrame me
  18.   if (pEvent = #prepareFrame) then doClose(me)
  19. end prepareFrame
  20.  
  21. -- standard behavior stuff --
  22. on getPropertyDescriptionList me
  23.   set defaultValues = GetDefaultValues (me)
  24.  
  25.   
  26.     if count(defaultValues) <> 0 then
  27.     errMessage = "The PDF_CloseViewer behavior needs to be placed" & \
  28.         RETURN & "on a frame that DOES NOT contain a PDF sprite." 
  29.     alert errMessage
  30.     exit
  31.   end if
  32.   
  33.   set p_list = [:]
  34.   addprop p_list, #pEvent, [ #comment: "Event", #format:#symbol, #range:[#mouseUp, #mouseDown, #prepareFrame], #default:#mouseUp]
  35.   return p_list
  36. end
  37.  
  38. on getBehaviorDescription
  39.   tmp = "Closes the Acrobat application that was launched using PDF_LaunchViewer."
  40.   tmp = tmp & RETURN& "All platforms." &RETURN&RETURN& "--- PARAMETERS ---"
  41.   tmp = tmp & RETURN& " - Event: prepareFrame, mouseUp, or mouseDown" 
  42.   tmp = tmp &RETURN&RETURN& "Free to use and abuse. (c)2002 - 2005, used under license from Integration New Media, Inc."
  43.   return tmp
  44. end
  45.  
  46. on getBehaviorTooltip
  47.   return "Closes the Acrobat application that was" & RETURN& "launched using PDF_LaunchViewer" &RETURN& "All platforms." 
  48. end
  49.  
  50. -- utils --
  51.  
  52. on GetDefaultValues me
  53.   if the currentSpriteNum then
  54.     set spriteList = GetSpriteList (me #PDF)
  55.     if count (spriteList) then
  56.       set defaultSprite = getAt (spriteList, 1)
  57.     else
  58.       set defaultSprite = 0
  59.     end if
  60.     
  61.     return [#spriteList: spriteList, #defaultSprite: defaultSprite]
  62.     
  63.   else -- the currentSpriteNum = 0
  64.     -- Director is merely recompiling this script: return an empty list
  65.     return []
  66.    end if 
  67. end 
  68.  
  69.  
  70. on GetSpriteList me, memberType
  71.   -- return list of sprites of type memberType in current frame
  72.   global version
  73.   if (char 1 of version = 6) then
  74.     set maxSprite = 120
  75.   else
  76.     set maxSprite = the lastChannel
  77.   end if
  78.   
  79.   set aList=[]
  80.   
  81.   repeat with i = 1 to maxSprite
  82.     set spriteMember = the member of sprite i
  83.     if (the type of spriteMember = memberType) then
  84.       append (aList, i)
  85.     end if
  86.   end repeat
  87.   
  88.   return aList
  89. end GetSpriteList
  90.  
  91.